package com.caojing.syby.ui.tenbuy;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.caojing.syby.ui.tenbuy.tenbuysharefragment.TenbuyShareFragment;

import java.util.List;

/**
 * Created by Administrator on 2016/10/5 0005.
 */
public class TenbuyViewpagerAdapter extends FragmentPagerAdapter{
   private List<TenbuyShareFragment>shareFragmentList;
    private String[]tabNames;

    public TenbuyViewpagerAdapter(FragmentManager fm, List<TenbuyShareFragment>shareFragmentList, String[]tabNames) {
        super(fm);
        this.shareFragmentList=shareFragmentList;
        this.tabNames=tabNames;
    }

    @Override
    public Fragment getItem(int position) {
        return shareFragmentList!=null?shareFragmentList.get(position):null;
    }

    @Override
    public int getCount() {
        return shareFragmentList!=null?shareFragmentList.size():0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabNames[position%shareFragmentList.size()];
    }
}
